/*
* Created by zhangkun on 2017/12/06
*/
define([
  './themes/lang/' + window.YUFP_SYS_CONFIG.language + '/pages/example/template/tabsearch.js'
], function (require, exports) {
  exports.ready = function (hashCode, data, cite) {
    yufp.lookup.reg('NATIONALITY');
    var vm = yufp.custom.vue({
      el: '#template_tabsearch',
      data: function () {
        var me = this;
        return {
          queryFields: [
            {placeholder: this.$t('tabsearch.gjz'), field: 'id', type: 'input'},
            {placeholder: this.$t('tabsearch.xxlx'), field: 'type', type: 'select', dataCode: 'NATIONALITY'}
          ],
          queryButtons: [
            { label: this.$t('tabsearch.ss'),
              op: 'submit',
              type: 'primary',
              icon: 'search',
              click: function (model, valid) {
                if (valid) {
                  var param = {condition: JSON.stringify(model)};
                  me.$refs.mytable.remoteData(param);
                }
              } },
            {label: this.$t('tabsearch.zz'), op: 'reset', type: 'primary', icon: 'yx-loop2'}
          ],

          tableColumns: [
            { label: this.$t('tabsearch.bm'), prop: 'id', width: 110 },
            { label: this.$t('tabsearch.mc'), prop: 'title', width: 200, sortable: true, resizable: true },
            { label: this.$t('tabsearch.lx'), prop: 'type', width: 110, dataCode: 'NATIONALITY' },
            { label: this.$t('tabsearch.zz'), prop: 'author', width: 110 },
            { label: this.$t('tabsearch.shr'), prop: 'auditor', width: 110 },
            { label: this.$t('tabsearch.yds'), prop: 'pageviews', width: 100 },
            { label: this.$t('tabsearch.zt'), prop: 'status', width: 120, dataCode: 'PUBLISH_STATUS' },
            { label: this.$t('tabsearch.sj'), prop: 'create_at'}
          ],
          dataUrl: '/trade/example/list',
          activeName: 'first'
        };
      },
      methods: {
        handleClick: function (tab, event) {

        }
      }
    });
  };
});
